# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>

pkgname=libva1-intel-driver
pkgver=1.8.3
pkgrel=2
pkgdesc='VA-API implementation for Intel G45 and HD Graphics family'
arch=('loong64' 'x86_64')
url='https://01.org/linuxmedia/vaapi'
license=('MIT')
depends=('libva1' 'libdrm')
makedepends=('git')
source=("git+https://github.com/intel/intel-vaapi-driver.git#tag=${pkgver}")
sha256sums=('SKIP')

prepare() {
  cd intel-vaapi-driver

  # Only relevant if intel-gpu-tools is installed,
  # since then the shaders will be recompiled
  sed -i '1s/python$/&2/' src/shaders/gpp.py

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd intel-vaapi-driver

  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

  export PKG_CONFIG_PATH='/usr/lib/libva1/pkgconfig'

  ./configure \
    --prefix='/usr' \
    --libdir='/usr/lib/libva1'
  make
}

package() {
  make DESTDIR="${pkgdir}" -C intel-vaapi-driver install
  install -Dm 644 intel-vaapi-driver/COPYING -t "${pkgdir}"/usr/share/licenses/libva1-intel-driver
}

# vim: ts=2 sw=2 et:
